package com.hksj.common.core.common;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public enum ProductTypeEnum {

    Yiqyl_Yangq_product("Yiqyl_Yangq", "氧气", "Yangq"),
    Yiqyl_Yaskq_product("Yiqyl_Yaskq", "压缩空气","Yaskq"),
    Yiqyl_Fuyqt_product("Yiqyl_Fuyqt", "负压气体","Fuyqt"),
    Yiqyl_Xiaoq_product("Yiqyl_Xiaoq", "笑气","Xiaoq"),
    Yiqyl_Danq_product("Yiqyl_Danq", "氮气","Danq"),
    Yiqyl_Yaq_product("Yiqyl_Yaq", "氩气","Yaq"),
    Yiqyl_Eryht_product("Yiqyl_Eryht", "二氧化碳","Eryht"),
    Yiqll_Yangq_product("Yiqll_Yangq", "氧气","Yangq");

    private String code;

    private String value;

    private String type;

    ProductTypeEnum(String code, String value, String type) {
        this.code = code;
        this.value = value;
        this.type = type;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public static List<String> getAllCode(){
        return Arrays.stream(ProductTypeEnum.values()).map(ProductTypeEnum::getCode).collect(Collectors.toList());
    }

    public static String getValueByCode(String code){
        for (ProductTypeEnum modelCodeEnum : ProductTypeEnum.values()) {
            if (modelCodeEnum.code.equals(code)){
                return modelCodeEnum.value;
            }
        }
        return null;
    }

    public static String getValueByType(String type){
        for (ProductTypeEnum modelCodeEnum : ProductTypeEnum.values()) {
            if (modelCodeEnum.type.equals(type)){
                return modelCodeEnum.value;
            }
        }
        return null;
    }
}
